package cc.realxyq.demo.aware;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @author kwhan
 * @date 2022年01月12日 15:06
 */
@Configuration
@Import(DemoAwareBeanPostProcessor.class)
public class AwareConfig {


    /**
     *  2022-01-12 18:58:57.257 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker
     *  - Bean 'awareConfig' of type [cc.realxyq.demo.aware.AwareConfig$$EnhancerBySpringCGLIB$$bd86f372]
     *  is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
     *
     *  这个日志消息，表明对于生命周期的顺序影响 ，如果通过@Bean的方式注入 BeanPostProcessor 是会影响生命周期的
     */
    //@Bean
    @SuppressWarnings("all")
    public DemoAwareBeanPostProcessor demoAwarePostProcessor() {
        return new DemoAwareBeanPostProcessor();
    }

    @Bean(initMethod = "init", destroyMethod = "close")
    public DemoAware demoAware() {
        return new DemoAware();
    }

}
